package com.linwen.javase.jdbc;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

public class JdbcDemo {
	public static void main(String[] args) throws Exception {
		Class.forName("com.mysql.cj.jdbc.Driver");
		Connection connection=DriverManager.getConnection("jdbc:mysql://localhost:3306/mybaties?characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true","root","123456789");
		String sql = "select * from user";
		Statement statement=connection.createStatement();
		ResultSet result= statement.executeQuery(sql);
		while(result.next()) {
			System.out.print(result.getString(1)+" ");
			System.out.print(result.getString(2)+" ");
			System.out.print(result.getString(3)+" ");
			System.out.print(result.getString(4)+" ");
			System.out.println(result.getString(5));
		}
		
	}
}
